/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.K300;
import queenb.web.util.PackageContants;

/**
 *
 * @author Nguyen Hung
 */
public class K300Store extends K300{

    public List<K300> getListK300All(int pnFH000, int pnFH200,String pvKV303, String pvLOGIN) {
        try {
            DataStatement data = new DataStatement(PackageContants.LIST_K300N, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                         new Param(OracleTypes.CHAR, pvKV303),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(data, K300.class);
        } catch (SQLException ex) {
            Logger.getLogger(K300Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(K300Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(K300Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    public int updateK300(int pnPK300,
            String pnKV301, String pnKV302,String pvKV303,
            int pnFH000, int pnFH200, String pvLOGIN) {
        DataStatement dataStetament = new DataStatement(PackageContants.UPDATE_K300N, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnPK300),
                    new Param(OracleTypes.CHAR, pnKV301),
                    new Param(OracleTypes.CHAR, pnKV302),
                     new Param(OracleTypes.CHAR, pvKV303),
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.CHAR, pvLOGIN),});
        try {
            return super.update(dataStetament, K300.class);
        } catch (SQLException ex) {
            Logger.getLogger(K300Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    public int deleteK300(int pnPK300, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.DELETE_K300, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPK300),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.update(dataStatement, K300.class);
        } catch (SQLException ex) {
            Logger.getLogger(K300Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }

    }
    
     public List<K300> findAllK300ForCombo(int pnFH000, int pnFH200, int pnPK300,String pvKV303, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.COMBO_K300N, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnPK300),
                         new Param(OracleTypes.CHAR, pvKV303),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(dataStatement, K300.class);
        } catch (SQLException ex) {
            Logger.getLogger(K300Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(K300Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(K300Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

}
